<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<title>梵創洗車</title>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0,user-scalable= no"/>

<link href="__PRIVATE__/css/style.css" rel="stylesheet">
<link href="__PRIVATE__/css/upload_img.css" rel="stylesheet">
<script type="text/javascript" src="__PRIVATE__/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="__PRIVATE__/js/jquery.SuperSlide.2.1.1.js"></script>
<script type="text/javascript" src="__PRIVATE__/js/dropdown.js"></script>
<script type="text/javascript" src="__PRIVATE__/js/jquery.cookie.js"></script>
<script type="text/javascript" src="__PRIVATE__/js/jquery.form.js"></script>
<!--head start-->
</head>
<body>

<div class="header">
	<div class="left fl"></div>
	<div class="title fl">梵創洗車</div>
	<div class="right fr"><div>地圖</div></div>
	<div class="cl"></div>
</div>
<script type="text/javascript">
$('.header .right div').click(function(){
	window.location.href = "{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/map')}";
});
</script>
<script src="__PRIVATE__/js/layer/layer.js"></script>
<form enctype="multipart/form-data" id="upForm" method="post">
	<div class="add_washer" onclick="showBg();">添加洗車員</div>
	<div class="show_washer"></div>
	
	<div class="upload_wash_info add_washer" style="display:none;">確認信息</div>
</div>

<div id="fullbg"></div> 
<div id="dialog"> 
		<div class="select_washer close">請選擇洗車員</div><!-- <a href="#" onclick="closeBg();">关闭</a> -->
		<div class="select_box">
			<foreach name="staffList" item="vo">
			  <div class="washer" num='0' server_id="{$vo.id}" onclick="">
			  	<div class="img fl"><img src="__PRIVATE__/Images/no_checked.png"/></div>
				<div class="fr washer_name">{$vo.name}</div>
				<div class="cl"></div>
			  </div>
		  	</foreach>
		</div> 
		<div class="submit_wash">
		  	<div class="cancel fl" onclick="closeBg();">取消</div>
		  	<div class="confirm fl">確認</div>
		  	<div class="cl"></div>
		</div>
</div>
<input type="hidden" id="s_id" name="s_id"/>
<input type="hidden" id="ordersn" name="ordersn" value="{$_GET['ordersn']}"/>
</form>
<script type="text/javascript"> 
$('.washer').click(function(){
	if($(this).attr('num')==0){
		$(this).children('.img').children('img').attr('src','__PRIVATE__/Images/checked.png');
		$(this).attr('num','1');
	}else{
		$(this).children('.img').children('img').attr('src','__PRIVATE__/Images/no_checked.png');
		$(this).attr('num','0');
	}
});
$('.confirm').click(function(){
	var id_list='';
	var name_list = '';
	$('#s_id').val("");
	$('.washer').each(function(){
		if($(this).attr('num')==1){
			id_list = $(this).attr('server_id') + ',' + id_list;
			name_list = name_list + ',' + $(this).children('.washer_name').html();
		}
	});
	$('#s_id').val(id_list);
	name_list = name_list.substring(1);
	$('.show_washer').html('您選擇了 '+name_list);
	$('.add_washer').hide();
	
	$('.upload_wash_info').show();
	closeBg();
});

$('.upload_wash_info').click(function(){
	 var formData = new FormData($( "#upForm" )[0]);   
     $.ajax({    
          url: "{:U(MODULE_NAME.'/'.CONTROLLER_NAME.'/select_washer')}" ,  /*这是处理文件上传的servlet*/  
          type: 'POST',    
          data : formData,    
          dataType: 'JSON',
          async: false,    
          cache: false,    
          contentType: false,    
          processData: false,    
          success:function(data){
  			if (data.status == 1) {
  				layer.open({
  					style:'font-size:1.6rem;',
  					content:data.info,
  					time:2,
  					end:function(){
  						window.location.href = data.url;
  					}
  				});
  			}else{
  				layer.open({
  					content:data.info,
  					time:2,
  				});
  			}
          }   
     });    
});

//显示灰色 jQuery 遮罩层 
function showBg() { 
	var bh = $("body").height(); 
	var bw = $("body").width(); 
	$("#fullbg").css({ 
	height:bh, 
	width:bw, 
	display:"block" 
	}); 
	$("#dialog").show(); 
} 
//关闭灰色 jQuery 遮罩 
function closeBg() { 
$("#fullbg,#dialog").hide(); 
} 
</script>
<script type="text/javascript">
$('.add_washer').click(function(){
	$('#div').show();
});
</script>

<script type="text/javascript">
$('title').html('洗車前的拍照記錄');
$('.header .title').html('洗車前的拍照記錄');
$('.header .title').css('font-size','1.5rem');
$('.header .left').html('<img src="__PRIVATE__/images/left.png" style="width:55%"/>');
$('.header .right').html('');
$('.header .left').click(function(){
	window.location.href = "{:U(MODULE_NAME.'/server/server_order_list')}"; 
});
</script>
